package com.llynosy.interview.mapper;

import com.llynosy.interview.po.Answer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AnswerMapper extends tk.mybatis.mapper.common.Mapper<Answer>{


    @Select("select * from tb_answer where problemId=#{problemId} order by likeNumber desc limit 1")
    Answer queryAnswerByProblemId(@Param("problemId")Long problemId);

    @Select("select id,answerUserName,createTime,content,likeNumber from tb_answer a where a.problemId=#{problemId}")
    List<Answer> querAnswersByProblemId(@Param("problemId")Long problemId);
}
